import type from "./action-type";
import { combineReducers } from "redux";

export const form = {
  username: "username",
  password: "password",
  password2: "password2"
};

const reducer = {};

const input = {
  [form.username]: "",
  [form.password]: "",
  [form.password2]: ""
};
reducer.input = (state = input, action = {}) => {
  const { payload } = action;

  switch (action.type) {
    case type.SET_INPUT:
      return { ...state, ...payload };
    default:
      return state;
  }
};

export default combineReducers({ ...reducer });
